package com.noahplat.fence.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * 功能：围栏实体类
 * name:宋彦磊
 * time:2021.03.08
 */

@Data
@Table(name = "tb_fence")
public class Fence {
    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;          //主键ID
    @Id
    private Long acctid;       //账套ID
    @NotNull(message = "经纬度不能为空")
    @Length(max = 100, message = "长度不能超过100位")
    private String point;        //经纬度
    @Length(max = 25)
    private Float radius;         //半径
    @NotNull(message = "围栏名称不能为空")
    @Length(max = 50, message = "长度不能超过50位")
    private String name;         //围栏名称
    @NotNull(message = "围栏类型不能为空")
    @Length(max = 1, message = "长度不能超过1位")
    private String type;        //围栏类型
    @NotNull(message = "围栏类型不能为空")
    @Length(max = 1, message = "长度不能超过1位")
    private String alarm;       //报警类型
    @NotNull(message = "围栏状态不能为空")
    @Length(max = 1, message = "长度不能超过1位")
    private String status;      //围栏状态
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date creattime;        //创建时间
    @NotNull(message = "备注不能为空")
    @Length(max = 255, message = "长度不能超过255位")
    private String apex;          //备注
    @Id
    private Long uid;          //创建围栏人员id
    @NotNull(message = "删除标识不能为空")
    @Length(max = 1, message = "长度不能超过1位")
    private String del;        //删除标识 Y：已删除  N：未删除

    @Transient
    private List<String> imei;  //围栏绑定设备集合
}
